<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
	<title>Black Admin v2 - Template Admin - Nice Theme</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style type="text/css" media="all">
@import url(css/style.css);
img {
	behavior: url('js/iepngfix.htc') !important;
}
</style>
	<script src="js/jquery.js" type="text/javascript"></script>
	<script src="js/jquery_ui.js" type="text/javascript"></script>
	<script src="js/wysiwyg.js" type="text/javascript"></script>
	<script src="js/functions.js" type="text/javascript"></script>
	</head>
	<body>
<div id="container">
<!-- Container -->
<div id="header"> <!-- Header -->
   <div id="title">
			 Admin
			<span>Quản lý webside</span>
		</div>
        </div>
<div id="sidebar"> <!-- Sidebar -->
		<div class="sidebox">
			<span class="stitle">Navigation</span>
		  <div id="navigation"> <!-- Navigation begins here -->
        <div class="sidenav"><!-- Sidenav -->
          <div class="navhead_blank"><span><a href="#" title="">Trở về trang chủ</a></span></div>
          <div class="navhead"><span>Album</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Taoalbum.php" title="">Tạo Album</a></li>
              <li><a href="album.php" title="">Quản lý Album</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Bài hát</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="thembaihat.php" title="">Thêm bài hát</a></li>
              <li><a href="quanlybaihat.php" title="">Quản lý bài hát</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Bình Luận</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="quanlycoment.php" title="">Quản lý Bình Luận</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Nghệ sĩ</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Themnghesi.php" title="">Thêm Nghệ sĩ</a></li>
              <li><a href="quanlynghesi.php" title="">Quản lý nghệ sĩ</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Playlist</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Taoplaylist.php" title="">Tạo Danh Sách Nhạc</a></li>
              <li><a href="Quanlydanhsachnhac.php" title="">Quản lý danh sách nhạc</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Thể Loại</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Themtheloai.php" title="">Thêm thể loại</a></li>
              <li><a href="quanlytheloainhac.php" title="">Quản lý thể loại</a></li>
            </ul>
          </div>
          <div class="navhead"><span>User</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="quanlyuser.php" title="">Quản lý user</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Album_music</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Album_music.php" title="">Quản lý Album_music</a></li>
               <li><a href="ThemAlbum_music.php" title="">Thêm Album_music</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Album_nghệ sĩ</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Album_nghesi.php" title="">Quản lý album_nghệ sĩ</a></li>
              <li><a href="themAlbum_nghesi.php" title="">Thêm album_nghệ sĩ</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Bài Hát_nghệ sĩ</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Music_nghesi.php" title="">Quản lý Bài Hát_nghệ sĩ</a></li>
              <li><a href="themMusic_nghesi.php" title="">Thêm Bài Hát_nghệ sĩ</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Music_Playlist</span></div>
					<div class="subnav">
						<ul class="submenu">
							<li><a href="Baihat_Playlist.php" title="">Quản lý Music_playlist</a></li>
                            <li><a href="themMusic_playlist.php" title="">Thêm Music_playlist</a></li>
							
						</ul>
					</div>
        </div>
      </div> <!-- END Navigation -->
		</div>
		<div class="sidebox">
			<span class="stitle">Additional Panel</span>
			<div id="datepicker"></div>

		</div>
		
		
	</div> 
<!-- END Sidebar -->
<div id="main"> <!-- Main, right side content -->
      <div id="content"> <!-- Content begins here -->
    
        
        
        <?php
			
			 $conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
              mysql_select_db("mp3", $conn);
				// cau lenh them 
				
              if (isset($_POST['loaibh'] ) ) 
			  {
				  	$loai=$_POST['loaibh'];
					$tenbaihat= $_POST['tenbh']; 
					$chatluong = $_POST['chatluongbh']; 
					$loibaihat= $_POST['loibh']; 
					$linkbaihat = $_POST['linkbh']; 
					$pic=$_POST['hinh']; 
					$id_theloai= $_POST['idtheloai']; 
				  	$qr = "call insertbh
				  ( ".$loai.",'".$tenbaihat."','". $chatluong."','". $loibaihat."', '".$linkbaihat."', '".$pic."', ".$id_theloai.")";				
				  mysql_query($qr);
				  echo "Thêm thành công";
				echo "<a href='quanlybaihat.php'>Trở lại trang quản lý bài hát</a>";
				
				  mysql_close($conn);
			  }
			 
			  
			  
			  
			/*  // CÂU LỆNH XỬ LÝ KIỂM TRA KHI THỰC HIỆN UPLOAD
			  	if($_SERVER['REQUEST_METHOD']=='POST')
			{
			if(isset($_FILES['hinh']) && is_uploaded_file($_FILES['hinh']['tmp_name']) && $_FILES['hinh']['error']==UPLOAD_ERR_OK)																					            	{
					foreach($_FILES['hinh'] as $key => $value){
						echo "$key: $value<br/>";
					}
				}else{ echo"No files upload";}
			}*/

		 ?>
         
    <form method="post" action="">
          <!-- Form --> 
          <!-- Fieldset -->
          <fieldset>
        <legend>Thêm bài hát</legend>
        
        <div class="input_field">
              <label for="sf">Loại</label>
              <input class="smallfield" name="loaibh" type="text" value="<?= $baihat['loai'] ?>" />
            </div>
        <div class="input_field">
              <label for="lf">Tên Bài Hát</label>
              <input class="bigfield" name="tenbh" type="text" value="<?= $baihat['tenmusic'] ?>" />
             
            </div>
        <div class="input_field">
        <label for="lf">Chất Lượng</label>
        <input class="bigfield" name="chatluongbh" type="text" value="<?= $baihat['chatluong'] ?>" />
        <div class="input_field">
        <label for="lf">Lời bài Hát</label>
        <textarea class="bigfield" name="loibh" type="text" value="<?= $baihat['lyric'] ?>" ></textarea>
        </div>
        <div class="input_field">
              <label for="lf">link</label>
              <input class="bigfield" name="linkbh" type="file" value="<?= $baihat['link'] ?>" />
            </div>
             <div class="input_field">
              <label for="lf">pic</label>
              <input class="bigfield" name="hinh" type="file" value="<?= $baihat['pic'] ?>" />
            </div>
        <div class="input_field">
              <label for="sf">ID_Thể Loại</label>
              <input class="smallfield" name="idtheloai" type="text" value=<?= $baihat['id_theloai'] ?>"" />
            </div>
        <div class="input_field">
              <input class="tao" name="them" type="submit" value="Thêm" />
            </div>
      </fieldset>
          <!-- End of fieldset -->
        </form>
        
    <!-- /Form -->
    <div class="clear"><!-- --></div>
    
    <!-- The paginator --> 
    
  </div>
      <div id="footer">
    <p>Copyright <a rel="dofollow" target="_blank" href="http://nicetheme.net/">Nice Theme</a> 2009. All rights reserved.</p>
  </div>
    </div>
<!-- END Container -->
</body>
</html>